package com.ssb.admin.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author duaichao
 * @since 2018/9/28 11:20
 */
@Data
@Component("uploadConfigure")
@ConfigurationProperties(prefix ="upload")
public class UploadConfigure {
    //获取存放位置
    private Map<String, String> localtion;
    //单个文件大小
    private String maxFileSize;
    //单次上传总文件大小
    private String maxRequestSize;

    public String getBasePath() {
        String location = "";
        String os = System.getProperty("os.name");
        if(os.toLowerCase().startsWith("win")) {
            location = this.getLocaltion().get("windows");
        } else {
            location = this.getLocaltion().get("linux");
        }
        return location;
    }
}
